﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once
#include "GcmpDatabase.h"

namespace gcmp
{
    class NdbObject;

    class GCMP_DATABASE_EXPORT NdbDataChangeUtils
    {
    public:
        static bool ValidatePropertyChange(NdbObject * pObject);
        static void NotifyElementPreChange(NdbObject * pObject);
        static void NotifyElementPostChange(NdbObject * pObject);
        static void CacheDataChangeCallStack(NdbObject * pObject);
        static void CheckTopOwnerObject(NdbObject* pObject);
    };

    /// \brief Ndb关闭数据层改动通知守卫
    ///
    /// 利用RAII，在对象构造的时候关闭通知，在对象析构的时候打开通知。
    /// 使用者需注意，不支持嵌套，不支持多线程。
    class GCMP_DATABASE_EXPORT NdbCloseDataChangeNotificationGuard
    {
    public:
        NdbCloseDataChangeNotificationGuard();
        ~NdbCloseDataChangeNotificationGuard();
    };
}
